package com.hmall.mapper;

import com.hmall.model.SysUser;
import com.hmall.util.MyMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SysUserMapper extends MyMapper<SysUser> {

    int myInsert(@Param("sysUser") SysUser sysUser) ;

    SysUser simpleUserByUsername(@Param("username") String username);

    SysUser hardUserByUsername(@Param("username") String username);


    int checkUsername(@Param("userName") String userName);

    int checkEmail(@Param("email") String email);

    SysUser selectLogin(@Param("username") String username, @Param("password") String password);

    String selectQuestionByUsername(String username);

    int checkAnswer(@Param("username") String username, @Param("question") String question, @Param("answer") String answer);

    int updatePasswordByUsername(@Param("username") String username, @Param("passwordNew") String passwordNew);

    int checkPassword(@Param(value = "password") String password, @Param("userId") Integer userId);

    int checkEmailByUserId(@Param(value = "email") String email, @Param(value = "userId") Integer userId);

    int selectIdByUsername(@Param(value = "username") String username);


    SysUser selectByUserId(@Param("userId") Integer userId);


    SysUser selectByUserName1(@Param("username1") String username1);

    List<SysUser> selectAccout(@Param("accout") String accout);
    int deleteUser(@Param("userId") Integer userId);

    int selectByUsername(@Param("tel") String tel);


    String selectNickNameByUserId(@Param("userId") Integer userId);

    String selectAvatarByUserId(@Param("userId") Integer userId);

    void delteUserTemp(@Param("userId") int userId);

    void deleteUserSearch(@Param("userId") int userId);

    void deleteUserRole(@Param("userId") int userId);

    void deleteUserExtra(@Param("userId") int userId);

    void deleteUserDetail(@Param("userId") int userId);

    void deleteUserDept(@Param("userId") int userId);

    void deleteSalesContHistory(@Param("userId") int userId);

    void deleteSalesCont(@Param("userId") int userId);

    void deleteOrderItem(@Param("userId") int userId);

    void deleteOrder(@Param("userId") int userId);

    void deleteHisitory(@Param("userId") int userId);

    void deleteCommentUserConnect(@Param("userId") int userId);

    void deleteCommentDetail(@Param("userId") int userId);

    void deleteComment(@Param("userId") int userId);

    void deleteCart(@Param("userId") int userId);

    Integer selectDealerIdByUserId(@Param("userId") Integer userId);

    List<SysUser> selectByDeptId(@Param("deptId") Integer deptId);

    List<SysUser> selectByNewDeptId(@Param("deptId") Integer deptId);


    List<SysUser> selectSaleManByUserIdList(@Param("userIdList") List<Integer> userIdList);

    List<Integer> selectUserIdListByDeptId(@Param("deptId") Integer deptId);

    List<SysUser> listDealerUserByDealerId(@Param("dealerId") Integer dealerId);

    SysUser selectNomalUserByUserName(@Param("username") String username);

    SysUser selectDeptUserByUserName(@Param("username") String username);

    List<SysUser> listDeptUserByDeptId(@Param("deptId") Integer deptId);

    List<SysUser> selectByUserIdList(@Param("userIdList") List<Integer> financeUserIdList);

    List<SysUser> selectSubUser(@Param("username") String username);

    /**
     * 根据dealerId找到所有业务员
     * @param id
     * @return
     */
    List<Integer> selectSalesmanListByDealerId(@Param("dealerId") Integer id);

    List<String> selectUsernameByExamRule(@Param("menuContent") String menuContent);

    SysUser selectSalesmanByUserId(@Param("userId") Integer userId);
}